/**
 * File: vel_sensor_sim.cpp
 * Brief: this node is work for sim the velocity sensor of the robot. It
 *        just receive velocity command from "/cmd_vel", then transmit it.
 * Created by: zhangping
 * Created at: 2017.07.9
 * Modified by: 
 * Modified at:
 **/

#include <boost/bind.hpp>
#include <boost/ref.hpp>
#include "ros/ros.h"
#include "geometry_msgs/Twist.h"


typedef const boost::function<void (const geometry_msgs::Twist::ConstPtr& msg)> Callback;
/**
 * This callback function for receive Twist message.
 */
void do_work(const geometry_msgs::Twist::ConstPtr& msg, ros::Publisher &pub)
{
	pub.publish(msg);
}


int main(int argc, char **argv)
{
    /**
     * Init Node.
     */
    ros::init(argc, argv, "vel_sensor_sim_node");
    ros::NodeHandle n;

    /**
     * deal with Institution message.
     */
    ros::Publisher vel_pub = n.advertise<geometry_msgs::Twist>("/robot/sensor/vel", 50);
    Callback callback = boost::bind(do_work, _1, boost::ref(vel_pub));
    ros::Subscriber sub = n.subscribe("/cmd_vel", 100, callback);

    /* wait */
    ros::spin();

    return 0;	
}



